package lab02.test03;

import javax.swing.*;

//属性
public class Student {
    String name;
    float mathScore;
    float pc;
    float english;
    public Student() {}

    //行为（有参构造）
    public Student(String name, float mathScore, float pc, float english) {
        //将局部变量的值传给成员变量
        this.name = name;
        this.mathScore = mathScore;
        this.pc = pc;
        this.english = english;
    }

    public float total() {
        return mathScore + pc + english;
    }

    public float Average() {
        return this.total() / 3;
    }

    public float top() {
        float top = mathScore > pc ? mathScore : pc;
        top = top > english ? top : english;
        return top;
    }

    public float lowest() {
        float lowest = mathScore > pc ? pc : mathScore;
        lowest = lowest > english ? english : lowest;
        return lowest;
    }

    public static void main(String[] args) {
        //传递参数
        Student infor = new Student("张三", 88, 90, 80);
        System.out.println(infor.name + "总分为：" + infor.total());
        System.out.println("平均分为：" + infor.Average());
        System.out.println("最高分为：" + infor.top());
        System.out.println("最低分为：" + infor.lowest());
    }

}
